class_name EquipJellyfish
extends EquipmentBase

@export var heal_interval: float = 1.0
var heal_timer: float = 0
@onready var animation_player: AnimationPlayer = $AnimationPlayer


func _ready() -> void:
	heal_timer = heal_interval


func _physics_process(delta: float) -> void:
	heal_timer -= delta
	if heal_timer <= 0:
		heal_timer = heal_interval
		heal()
		

func heal():
	var heal_point = item_data.item_config.heal_point
	var player = holder as Player
	if player.player_data.hp >= player.player_data.max_hp:
		return
	
	animation_player.play("heal")
	
	player.player_data.add_hp(heal_point)
	GlobalSignals.player_info_changed.emit()
	player.level.emit_particle("particle_add_life_effect", player.ray_cast_point.global_position)
